package com.itboye.lottery.adapter;

import android.app.Activity;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.itboye.lottery.R;
import com.itboye.lottery.activity.ZqBetListActivity;
import com.itboye.lottery.bean.FootballMatchBean;
import com.itboye.lottery.bean.ZqBetListItem;

import java.util.ArrayList;

/**
 * Created by wu on 2018/1/9.
 */

public class ZqBetListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements CompoundButton.OnCheckedChangeListener {

    private ArrayList<ZqBetListItem> zqBetListItemArrayList;
    private Activity activity;
    private Context context;
    private boolean lotteryType;
    private int pager = 0;
    private ArrayList<FootballMatchBean> footballMatchBeanArrayList;

    public ZqBetListAdapter(Activity activity, ArrayList<ZqBetListItem> zqBetListItemArrayList) {
        this.activity = activity;
        this.zqBetListItemArrayList = zqBetListItemArrayList;
    }

    public OnItemClickListener itemClickListener;

    public void setOnItemClickListener(ZqBetListAdapter.OnItemClickListener itemClickListener) {
        this.itemClickListener = itemClickListener;
    }

    public void setPager(int pager) {
        this.pager = pager;
        notifyDataSetChanged();
    }

    public void setOldArrayList(ArrayList<FootballMatchBean> footballMatchBeanArrayList) {
        this.footballMatchBeanArrayList = footballMatchBeanArrayList;
    }

    @Override
    public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
        try {
            int position = Integer.parseInt(compoundButton.getTag(R.id.tag_2) + "");
            String value = compoundButton.getTag(R.id.tag_1) + "";
            int isExit = isChoose(pager, value, position);
            if (b) {
                if (pager == 1) {//胜平负
                    if (isExit == -1) {
                        ZqBetListItem.SpfBean spfBean = new ZqBetListItem.SpfBean();
                        spfBean.setKey(value.split("_")[0]);
                        spfBean.setValue(value.split("_")[1]);
                        zqBetListItemArrayList.get(position).getSpfList().add(spfBean);
                    }
                } else if (pager == 2) {//让球胜平负
                    if (isExit == -1) {
                        ZqBetListItem.SpfBean spfBean = new ZqBetListItem.SpfBean();
                        spfBean.setKey(value.split("_")[0]);
                        spfBean.setValue(value.split("_")[1]);
                        zqBetListItemArrayList.get(position).getRspfList().add(spfBean);
                    }
                } else if (pager == 5) {//半全场
                    if (isExit == -1) {
                        ZqBetListItem.SpfBean spfBean = new ZqBetListItem.SpfBean();
                        spfBean.setKey(value.split("_")[0]);
                        spfBean.setValue(value.split("_")[1]);
                        zqBetListItemArrayList.get(position).getBqcList().add(spfBean);
                    }
                }
            } else {
                if (pager == 1) {//胜平负
                    if (isExit != -1) {
                        zqBetListItemArrayList.get(position).getSpfList().remove(isExit);
                    }
                } else if (pager == 2) {//让球胜平负
                    if (isExit != -1) {
                        zqBetListItemArrayList.get(position).getRspfList().remove(isExit);
                    }
                } else if (pager == 5) {//半全场
                    if (isExit != -1) {
                        zqBetListItemArrayList.get(position).getBqcList().remove(isExit);
                    }
                }
            }
            ((ZqBetListActivity) activity).caculateVoteNums();
        } catch (Exception e) {

        }
        Log.v("choose_data", zqBetListItemArrayList.toString());
    }

    public interface OnItemClickListener {
        void onItemClick(View view, int position);
    }

    int isChoose(int pager, String selectValue, int position) {
        int index = -1;
        switch (pager) {
            case 0:
                break;
            case 1:
                for (int i = 0; i < zqBetListItemArrayList.get(position).getSpfList().size(); i++) {
                    if (zqBetListItemArrayList.get(position).getSpfList().get(i).getKey().contains(selectValue.split("_")[0])) {
                        index = i;
                        break;
                    }
                }
                break;
            case 2:
                for (int i = 0; i < zqBetListItemArrayList.get(position).getRspfList().size(); i++) {
                    if (zqBetListItemArrayList.get(position).getRspfList().get(i).getKey().contains(selectValue.split("_")[0])) {
                        index = i;
                        break;
                    }
                }
                break;
            case 5:
                for (int i = 0; i < zqBetListItemArrayList.get(position).getBqcList().size(); i++) {
                    if (zqBetListItemArrayList.get(position).getBqcList().get(i).getKey().contains(selectValue.split("_")[0])) {
                        index = i;
                        break;
                    }
                }
                break;
        }
        return index;
    }

    public void clearAllStatus() {
//        for (int i = 0; i < codeBeanArrayList.size(); i++) {
//            if (codeBeanArrayList.get(i).isSelect()) {
//                codeBeanArrayList.get(i).setSelect(false);
//            }
//        }
        notifyDataSetChanged();
    }


    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        context = parent.getContext();
        View v = LayoutInflater.from(context).inflate(R.layout.item_zq_bet_list, parent, false);
        return new ViewHolder(v);
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        ViewHolder viewHolder = (ViewHolder) holder;
        ZqBetListItem zqBetListItem = zqBetListItemArrayList.get(position);
        viewHolder.item_zqbet_list_team.setText(zqBetListItem.gethTeam() + "VS" + zqBetListItem.getaTeam());
        viewHolder.item_zqbet_list_endtime.setText(zqBetListItem.getbDate() + " 截止");
        viewHolder.item_zqbet_list_delete.setTag(position);
        viewHolder.item_zqbet_list_delete.setOnClickListener((ZqBetListActivity) activity);
        resetAllViews(viewHolder);
        switch (pager) {
            case 0:
                viewHolder.item_zqbet_list_huntou_spf_root.setVisibility(View.VISIBLE);
                addAllBet(zqBetListItem, viewHolder);
                break;
            case 1:
                viewHolder.item_bq_bet_list_spf_root.setVisibility(View.VISIBLE);
                addSpf(zqBetListItem, viewHolder, position, true);
                break;
            case 2:
                viewHolder.item_bq_bet_list_spf_root.setVisibility(View.VISIBLE);
                addSpf(zqBetListItem, viewHolder, position, false);
                break;
            case 3:
                viewHolder.item_bq_bet_list_zjq_root.setVisibility(View.VISIBLE);
                addZjq(zqBetListItem, viewHolder, position);
                break;
            case 4:
                viewHolder.item_zqbet_list_bf_root.setVisibility(View.VISIBLE);
                addBf(zqBetListItem, viewHolder, position);
                break;
            case 5:
                viewHolder.item_zqbet_list_bqc_root.setVisibility(View.VISIBLE);
                addBqc(zqBetListItem, viewHolder, position);
                break;
        }
    }

    private void addBqc(ZqBetListItem zqBetListItem, ViewHolder viewHolder, int position) {
        int gP = zqBetListItemArrayList.get(position).getgPosition();
        int cP = zqBetListItemArrayList.get(position).getcPosition();
        CheckBox checkBox0 = (CheckBox) viewHolder.ll_bqc_child_1.getChildAt(0);
        CheckBox checkBox1 = (CheckBox) viewHolder.ll_bqc_child_1.getChildAt(1);
        CheckBox checkBox2 = (CheckBox) viewHolder.ll_bqc_child_1.getChildAt(2);
        CheckBox checkBox3 = (CheckBox) viewHolder.ll_bqc_child_2.getChildAt(0);
        CheckBox checkBox4 = (CheckBox) viewHolder.ll_bqc_child_2.getChildAt(1);
        CheckBox checkBox5 = (CheckBox) viewHolder.ll_bqc_child_2.getChildAt(2);
        CheckBox checkBox6 = (CheckBox) viewHolder.ll_bqc_child_3.getChildAt(0);
        CheckBox checkBox7 = (CheckBox) viewHolder.ll_bqc_child_3.getChildAt(1);
        CheckBox checkBox8 = (CheckBox) viewHolder.ll_bqc_child_3.getChildAt(2);
        setCheckBoxTag(checkBox0, R.id.tag_2, position + "");
        setCheckBoxTag(checkBox1, R.id.tag_2, position + "");
        setCheckBoxTag(checkBox2, R.id.tag_2, position + "");
        setCheckBoxTag(checkBox2, R.id.tag_2, position + "");
        setCheckBoxTag(checkBox3, R.id.tag_2, position + "");
        setCheckBoxTag(checkBox4, R.id.tag_2, position + "");
        setCheckBoxTag(checkBox5, R.id.tag_2, position + "");
        setCheckBoxTag(checkBox6, R.id.tag_2, position + "");
        setCheckBoxTag(checkBox7, R.id.tag_2, position + "");
        setCheckBoxTag(checkBox8, R.id.tag_2, position + "");
        removeCheckListener(checkBox0, checkBox1, checkBox2, checkBox3, checkBox4, checkBox5, checkBox6, checkBox7, checkBox8);
        //先绘制UI
        for (int i = 0; i < footballMatchBeanArrayList.size(); i++) {
            FootballMatchBean.MatchInfo.HAFUBean hafuBean = footballMatchBeanArrayList.get(gP).getMatchList().get(cP).getHAFU();
            checkBox0.setText("胜胜 " + hafuBean.getSpecial_odds().getHh());
            setCheckBoxTag(checkBox0, R.id.tag_1, "胜胜_" + hafuBean.getSpecial_odds().getHh());
            checkBox1.setText("平胜 " + hafuBean.getSpecial_odds().getDh());
            setCheckBoxTag(checkBox1, R.id.tag_1, "平胜_" + hafuBean.getSpecial_odds().getDh());
            checkBox2.setText("负胜 " + hafuBean.getSpecial_odds().getAh());
            setCheckBoxTag(checkBox2, R.id.tag_1, "负胜_" + hafuBean.getSpecial_odds().getAh());
            checkBox3.setText("胜平 " + hafuBean.getSpecial_odds().getHd());
            setCheckBoxTag(checkBox3, R.id.tag_1, "胜平_" + hafuBean.getSpecial_odds().getHd());
            checkBox4.setText("平平 " + hafuBean.getSpecial_odds().getDd());
            setCheckBoxTag(checkBox4, R.id.tag_1, "平平_" + hafuBean.getSpecial_odds().getDd());
            checkBox5.setText("负平 " + hafuBean.getSpecial_odds().getAh());
            setCheckBoxTag(checkBox5, R.id.tag_1, "负平_" + hafuBean.getSpecial_odds().getAh());
            checkBox6.setText("胜负 " + hafuBean.getSpecial_odds().getHa());
            setCheckBoxTag(checkBox6, R.id.tag_1, "胜负_" + hafuBean.getSpecial_odds().getHa());
            checkBox7.setText("平负 " + hafuBean.getSpecial_odds().getDa());
            setCheckBoxTag(checkBox7, R.id.tag_1, "平负 _" + hafuBean.getSpecial_odds().getDa());
            checkBox8.setText("负负 " + hafuBean.getSpecial_odds().getAa());
            setCheckBoxTag(checkBox8, R.id.tag_1, "负负_" + hafuBean.getSpecial_odds().getAa());
        }
        //在绘制选中状态
        for (int i = 0; i < zqBetListItem.getBqcList().size(); i++) {
            ZqBetListItem.SpfBean spfBean = zqBetListItem.getBqcList().get(i);
            if (spfBean.getValue().equals("胜胜")) {
                checkBox0.setChecked(true);
            }
            if (spfBean.getValue().equals("平胜")) {
                checkBox1.setChecked(true);
            }
            if (spfBean.getValue().equals("负胜")) {

                checkBox2.setChecked(true);
            }
            if (spfBean.getValue().equals("胜平")) {

                checkBox3.setChecked(true);
            }
            if (spfBean.getValue().equals("平平")) {

                checkBox4.setChecked(true);
            }
            if (spfBean.getValue().equals("负平")) {

                checkBox5.setChecked(true);
            }
            if (spfBean.getValue().equals("胜负")) {

                checkBox6.setChecked(true);
            }
            if (spfBean.getValue().equals("平负")) {

                checkBox7.setChecked(true);
            }
            if (spfBean.getValue().equals("负负")) {
                checkBox8.setChecked(true);
            }
        }

        setCheckListener(checkBox0, checkBox1, checkBox2, checkBox3, checkBox4, checkBox5, checkBox6, checkBox7, checkBox8);

    }

    private void setCheckBoxTag(CheckBox checkBox, int id, String tag) {
        checkBox.setTag(id, tag);
    }

    private void setCheckListener(CheckBox... checkBox0) {
        for (CheckBox checkBox : checkBox0) {
            checkBox.setOnCheckedChangeListener(this);
        }
    }

    private void removeCheckListener(CheckBox... checkBox0) {
        for (CheckBox checkBox : checkBox0) {
            checkBox.setOnCheckedChangeListener(null);
        }
    }


    private void addBf(ZqBetListItem zqBetListItem, ViewHolder viewHolder, int position) {
        String header = "<font color='red'>";
        StringBuffer strS = new StringBuffer("胜：");
        StringBuffer strP = new StringBuffer("平：");
        StringBuffer strF = new StringBuffer("负：");
        for (int i = 0; i < zqBetListItem.getBfList().size(); i++) {
            String key = zqBetListItem.getBfList().get(i).getKey();
            int s1 = 0, s2 = 0;
            if (i == 0) {
                strS.append(header);
                strP.append(header);
                strF.append(header);
            }
            if (key.equals("胜其它")) {
                strS.append(key + " ");
            } else if (key.equals("负其它")) {
                strF.append(key + " ");
            } else if (key.equals("平其它")) {
                strP.append(key + " ");
            } else {
                if (key.contains(":")) {
                    s1 = Integer.valueOf(key.split(":")[0]);
                    s2 = Integer.valueOf(key.split(":")[1]);
                } else {
                    s1 = Integer.valueOf(key.substring(0, 1));
                    s2 = Integer.valueOf(key.substring(1, 1));
                }
                if (s1 > s2) {
//                if (i == 0) {
//                    strS.append("<font color='red'>");
//                }
                    strS.append(key + "    ");
                } else if (s1 == s2) {
//                strP.append("<font color='red'>");
                    strP.append(key + "    ");
                } else {
//                strF.append("<font color='red'>");
                    strF.append(key + "    ");
                }
            }
        }
        viewHolder.item_zqbet_list_bf_s.setVisibility(strS.toString().length() <= header.length() + 2 ? View.GONE : View.VISIBLE);
        viewHolder.item_zqbet_list_bf_p.setVisibility(strP.toString().length() <= header.length() + 2 ? View.GONE : View.VISIBLE);
        viewHolder.item_zqbet_list_bf_f.setVisibility(strF.toString().length() <= header.length() + 2 ? View.GONE : View.VISIBLE);
        viewHolder.item_zqbet_list_bf_s.setText(Html.fromHtml(strS.append("</font>").toString()));
        viewHolder.item_zqbet_list_bf_p.setText(Html.fromHtml(strP.append("</font>").toString()));
        viewHolder.item_zqbet_list_bf_f.setText(Html.fromHtml(strF.append("</font>").toString()));
    }

    private void addZjq(ZqBetListItem zqBetListItem, ViewHolder viewHolder, int position) {
        StringBuffer stringBuffer = new StringBuffer();
        for (int i = 0; i < zqBetListItem.getZjqList().size(); i++) {
            ZqBetListItem.SpfBean spfBean = zqBetListItem.getZjqList().get(i);
            stringBuffer.append(spfBean.getKey().substring(0, 1) + "(" + spfBean.getValue() + ")    ");
            if (i == 3) {
                stringBuffer.append("<br />");
            }
        }
        viewHolder.item_bq_bet_list_zjq_value.setText(Html.fromHtml(stringBuffer.toString()));
    }

    private void addSpf(ZqBetListItem zqBetListItem, ViewHolder viewHolder, int posistion, boolean isSpf) {
        for (int i1 = 0; i1 < viewHolder.item_bq_bet_list_spf_root.getChildCount(); i1++) {
            CheckBox checkBox = (CheckBox) viewHolder.item_bq_bet_list_spf_root.getChildAt(i1);
            removeCheckListener(checkBox);
            int gP = zqBetListItemArrayList.get(posistion).getgPosition();
            int cP = zqBetListItemArrayList.get(posistion).getcPosition();
            String text = "";
            String str = "";
            FootballMatchBean.MatchInfo.HADBean hadBean = isSpf ? footballMatchBeanArrayList.get(gP).getMatchList().get(cP).getHAD() : footballMatchBeanArrayList.get(gP).getMatchList().get(cP).getHHAD();
            switch (i1) {
                case 0:
                    text = "主胜 " + hadBean.getH();
                    str = "主胜_" + hadBean.getH();
                    break;
                case 1:
                    text = "平 " + hadBean.getD();
                    str = "平_" + hadBean.getD();
                    break;
                case 2:
                    text = "客胜 " + hadBean.getA();
                    str = "客胜_" + hadBean.getA();
                    break;
            }
            checkBox.setText(text);
            StringBuilder tag = new StringBuilder(str);
            setCheckBoxTag(checkBox, R.id.tag_1, tag.toString());
            setCheckBoxTag(checkBox, R.id.tag_2, posistion + "");
            checkBox.setChecked(false);
            setCheckListener(checkBox);
        }
        ArrayList<ZqBetListItem.SpfBean> spfBeanArrayList = isSpf ? zqBetListItem.getSpfList() : zqBetListItem.getRspfList();
        for (int i = 0; i < (spfBeanArrayList.size()); i++) {
            if (spfBeanArrayList.get(i).getKey().equals("主胜")) {
                ((CheckBox) viewHolder.item_bq_bet_list_spf_root.getChildAt(0)).setChecked(true);
                setCheckListener(((CheckBox) viewHolder.item_bq_bet_list_spf_root.getChildAt(0)));
            } else if (spfBeanArrayList.get(i).getKey().equals("平")) {
                ((CheckBox) viewHolder.item_bq_bet_list_spf_root.getChildAt(1)).setChecked(true);
                setCheckListener(((CheckBox) viewHolder.item_bq_bet_list_spf_root.getChildAt(1)));
            } else if (spfBeanArrayList.get(i).getKey().equals("客胜")) {
                ((CheckBox) viewHolder.item_bq_bet_list_spf_root.getChildAt(2)).setChecked(true);
                setCheckListener(((CheckBox) viewHolder.item_bq_bet_list_spf_root.getChildAt(2)));
            } else {

            }

        }

    }

    private void resetAllViews(ViewHolder holder) {
        holder.item_zqbet_list_huntou_spf_root.setVisibility(View.GONE);
        holder.item_bq_bet_list_spf_root.setVisibility(View.GONE);
        holder.item_bq_bet_list_zjq_root.setVisibility(View.GONE);
        holder.item_zqbet_list_bf_root.setVisibility(View.GONE);
        holder.item_zqbet_list_bqc_root.setVisibility(View.GONE);
    }

    private void addAllBet(ZqBetListItem zqBetListItem, ViewHolder viewHolder) {
        String str = "";
        for (ZqBetListItem.SpfBean spfBean : zqBetListItem.getSpfList()) {
            str += spfBean.getKey() + " ";
        }
        viewHolder.item_zqbet_list_spf.setVisibility(str.isEmpty() ? View.GONE : View.VISIBLE);
        viewHolder.item_zqbet_list_spf.setText(Html.fromHtml("胜负平 " + "<font color='red'>" + str + "</font>"));
        str = "";
        for (ZqBetListItem.SpfBean spfBean : zqBetListItem.getRspfList()) {
            str += spfBean.getKey() + " ";
        }
        viewHolder.item_zqbet_list_rq.setVisibility(str.isEmpty() ? View.GONE : View.VISIBLE);
        viewHolder.item_zqbet_list_rq.setText(Html.fromHtml("让球 " + "<font color='red'>" + str + "</font>"));
        str = "";
        for (ZqBetListItem.SpfBean spfBean : zqBetListItem.getBfList()) {
            str += spfBean.getKey() + " ";
        }
        viewHolder.item_zqbet_list_bf.setVisibility(str.isEmpty() ? View.GONE : View.VISIBLE);
        viewHolder.item_zqbet_list_bf.setText(Html.fromHtml("比分 " + "<font color='red'>" + str + "</font>"));
        str = "";
        for (ZqBetListItem.SpfBean spfBean : zqBetListItem.getZjqList()) {
            str += spfBean.getKey() + " ";
        }
        viewHolder.item_zqbet_list_zjq.setVisibility(str.isEmpty() ? View.GONE : View.VISIBLE);
        viewHolder.item_zqbet_list_zjq.setText(Html.fromHtml("总进球 " + "<font color='red'>" + str + "</font>"));
        str = "";
        for (ZqBetListItem.SpfBean spfBean : zqBetListItem.getBqcList()) {
            str += spfBean.getValue() + " ";
        }
        viewHolder.item_zqbet_list_bqc.setVisibility(str.isEmpty() ? View.GONE : View.VISIBLE);
        viewHolder.item_zqbet_list_bqc.setText(Html.fromHtml("半全场 " + "<font color='red'>" + str + "</font>"));
    }


    @Override
    public int getItemCount() {
        return zqBetListItemArrayList == null ? 0 : zqBetListItemArrayList.size();
    }

    public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
        public ImageView item_zqbet_list_delete;
        TextView item_zqbet_list_endtime, item_zqbet_list_team;

        TextView item_zqbet_list_spf, item_zqbet_list_rq, item_zqbet_list_bf, item_zqbet_list_zjq, item_zqbet_list_bqc, item_bq_bet_list_zjq_value;
        TextView item_zqbet_list_bf_s, item_zqbet_list_bf_f, item_zqbet_list_bf_p;
        LinearLayout item_zqbet_list_huntou_spf_root, item_bq_bet_list_spf_root, item_zqbet_list_bf_root, item_zqbet_list_bqc_root;
        RelativeLayout item_bq_bet_list_zjq_root;
        LinearLayout ll_bqc_child_1, ll_bqc_child_2, ll_bqc_child_3;

        public ViewHolder(View itemView) {
            super(itemView);
            item_zqbet_list_delete = itemView.findViewById(R.id.item_zqbet_list_delete);
            item_zqbet_list_team = itemView.findViewById(R.id.item_zqbet_list_team);
            item_zqbet_list_endtime = itemView.findViewById(R.id.item_zqbet_list_endtime);
            item_zqbet_list_spf = itemView.findViewById(R.id.item_zqbet_list_spf);
            item_zqbet_list_rq = itemView.findViewById(R.id.item_zqbet_list_rq);
            item_zqbet_list_bf = itemView.findViewById(R.id.item_zqbet_list_bf);
            item_zqbet_list_zjq = itemView.findViewById(R.id.item_zqbet_list_zjq);
            item_zqbet_list_bqc = itemView.findViewById(R.id.item_zqbet_list_bqc);
            item_zqbet_list_huntou_spf_root = itemView.findViewById(R.id.item_bq_bet_list_huntou_root);
            item_bq_bet_list_spf_root = itemView.findViewById(R.id.item_bq_bet_list_spf_root);
            item_bq_bet_list_zjq_root = itemView.findViewById(R.id.item_bq_bet_list_zjq_root);
            item_zqbet_list_bf_root = itemView.findViewById(R.id.item_zqbet_list_bf_root);
            item_zqbet_list_bqc_root = itemView.findViewById(R.id.item_zqbet_list_bqc_root);
            item_bq_bet_list_zjq_value = itemView.findViewById(R.id.item_bq_bet_list_zjq_value);
            item_zqbet_list_bf_s = itemView.findViewById(R.id.item_zqbet_list_bf_s);
            item_zqbet_list_bf_f = itemView.findViewById(R.id.item_zqbet_list_bf_f);
            item_zqbet_list_bf_p = itemView.findViewById(R.id.item_zqbet_list_bf_p);
            ll_bqc_child_1 = itemView.findViewById(R.id.ll_bqc_child_1);
            ll_bqc_child_2 = itemView.findViewById(R.id.ll_bqc_child_2);
            ll_bqc_child_3 = itemView.findViewById(R.id.ll_bqc_child_3);
            itemView.setOnClickListener(this);
        }

        @Override
        public void onClick(View v) {
            if (itemClickListener != null) {
                itemClickListener.onItemClick(v, getAdapterPosition());
            }
        }
    }
}
